﻿using AutoMapper;
using BillUI.AutoMapper;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Web;

namespace BillUI
{
    public class MapperTools
    {

        private static IMapper _mapper = null;

        public static IMapper Mapper
        {
            get
            {
                if(_mapper == null)
                {
                    Initialise();
                }
                return _mapper;
            }
        }

        /// <summary>
        /// 初始化容器
        /// </summary>
        private static void Initialise()
        {
           
            var config = new MapperConfiguration(
                     cfg =>
                     {
                         cfg.AddProfile(new Bills_Profile());
                     }
                     );

            _mapper = config.CreateMapper();        
        }
    }
}